var baseUrl = "https://api.tf2sc.cn/api/tfcar/"


// 便选 https://api.tf2sc.cn/api/tfcar/car/convenient
const convenient = baseUrl + "car//convenient";

// 二手车  https://api.tf2sc.cn/api/tfcar/car/list?
const list = baseUrl + "car/list";

// 新车 https://api.tf2sc.cn/api/tfcar/newCar/list?
const newCar = baseUrl + "newCar/list";

// 新闻咨询 https://api.tf2sc.cn/api/tfcar/website/allNews
const website = baseUrl + "website/allNews";

// 价格标签 https://api.tf2sc.cn/api/tfcar/car/price?
const price = baseUrl + "car/price";

// 车型标签 https://api.tf2sc.cn/api/tfcar/car/model
const model = baseUrl + "car/model";

// 品牌标签 https://api.tf2sc.cn/api/tfcar/car/brand300
const brand300 = baseUrl + "car/brand300";

// 更多标签 https://api.tf2sc.cn/api/tfcar/car/moreScreen
const moreScreen = baseUrl + "car/moreScreen";

// 城市省份 https://api.tf2sc.cn/api/tfcar/city/treeList
const city = baseUrl + "city/treeList";


function requst(path, data) {
	return new Promise(resolve => {
		uni.request({
			url: path,
			data,
			header: {
				'PlatformType': 'h5',
			},
			success: res => {
				resolve(res)
			}
		})
	})
}
const getConvenient = data => requst(convenient, data);
const getList = data => requst(list, data);
const getNewCar = data => requst(newCar, data);
const getWebsite = data => requst(website, data);
const getPrice = data => requst(price, data);
const getModel = data => requst(model, data);
const getBrand300 = data => requst(brand300, data);
const getMoreScreen = data => requst(moreScreen, data);
const getCity = data => requst(city, data);

export {
	getConvenient,
	getList,
	getNewCar,
	getWebsite,
	getPrice,
	getModel,
	getBrand300,
	getMoreScreen,
	getCity,
}